#ifndef __OBJECTGROUP_MANAGER_H__
#define __OBJECTGROUP_MANAGER_H__

#pragma once

#include <Singleton.h>
#include <SolarHashTable.h>
#include <MemoryPoolFactory.h>

using namespace util;

class ObjectGroup;


class ObjectGroupManager
{
public:
	enum { MAX_DEFAULT_POOL_SIZE = 10, };
	ObjectGroupManager();
	~ObjectGroupManager();

	VOID			Release();
	VOID			Init( DWORD dwMaxPoolSize );

	ObjectGroup*	AllocGroup( DWORD dwAreaID, DWORD dwGroupID );
	BOOL			RemoveGroup( ObjectGroup *pGroup );
	ObjectGroup*	FindGroup( DWORD dwAreaID, DWORD dwGroupID );
	ObjectGroup*	FindGroup( DWORD64 dwGroupKey )		{ return m_pGroupList->GetData( dwGroupKey ); }

private:
	CMemoryPoolFactory<ObjectGroup> *				m_pGroupPool;
	util::SolarHashTable<ObjectGroup *, DWORD64> *	m_pGroupList;
};

#endif // __OBJECTGROUP_MANAGER_H__
